<body style="padding-top: 0">

<div class="ypfood-head">
    <div class="back-div" onClick="javascript :history.back(-1);"><img src="/statics/imgs/head-back.png?v=${params.ver}">
    </div>
    <div>
        <span class="title-span">登录</span>
    </div>
</div>
<div style="padding-top: 60px;">
    <%--<div id="logo">
        <img src="/statics/imgs/register-logo.png?v=${params.ver}">
        <hr>
    </div>--%>
    <div style="text-align: center;padding: 20px;color: red;">
        请向物业公司相关人员咨询账号及密码
    </div>
    <div id="reg">
        <div style="width: 100%;background-color: #ffa000;height: 3px;"></div>
        <div class="regPanel">
            <ul>
                <li class="backColor">
                    <input type="text" value="${param.mob}"
                           style="background-image:url('/statics/imgs/icon-my-l.png?v=${params.ver}');"
                           id="mobile" name="mobile"
                           placeholder="请输入手机号">
                    <span id="mobilePopImg" class="popImg imgHide"><img src="/statics/imgs/ok.png?v=${params.ver}"></span>
                    <span id="mobilePop" class="pop"></span>
                </li>
                <li class="backColor">
                    <input type="password" style="background-image:url('/statics/imgs/icon-lock-l.png?v=${params.ver}');"
                           id="password"
                           placeholder="请输入密码">
                    <span id="passwordPopImg" class="popImg imgHide"><img
                            src="/statics/imgs/ok.png?v=${params.ver}"></span>
                    <span id="passwordPop" class="pop"></span>
                </li>
                <li>
                    <div id="loginButtonDo"
                         style="background-size: 100% 100%;font-size:18px;font-weight:800;color:white;background-image: url('/statics/imgs/extendGroupRegButton.png');width: 100%;height: 45px;">
                        登录
                    </div>
                </li>
                <li class="a">
                    <div style="width: 50%;float: right;padding-right: 10px;text-align: right;"><a href="/user/forgetpw.jspx"
                                                                                                   style="color:#999999;">忘记密码</a>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</div>


<script>
    $("#password").blur(function () {
        //$("#mobilePop").html("");
    });
    $("#mobile,#password").focus(function () {
        $("#mobilePop").html("&nbsp;");
        $("#passwordPop").html("");
    });
    function loginAction() {
        var m = $("#mobile").val();
        /*if (m.length != 11) {
         $("#mobilePop").html("手机号格式不对");
         return;
         }*/
        var p = $("#password").val();
        if (p == "") {
            $("#passwordPopImg").addClass("imgHide");
            $("#passwordPop").html("密码不能为空");
        }
        json("/user/loginAction.jspx", {password: p, mobile: m}, function (data) {
            if (data.code == 0) {
                if('${param.uri}'!=""){
                    window.location.href = decodeURIComponent('${param.uri}');
                }else {
                    window.location.href = "/";
                }
            } else if (data.code == 1400) {
                $("#passwordPop").html(data.description);
            } else if (data.code == 1302) {
                $("#mobilePop").html("用户不存在");
            }
        });
    }
    $("#loginButtonDo").bind("click", loginAction);

    $("body").keydown(function (e) {
        if (e.keyCode == 13) {
            loginAction();
        }
    });
</script>